/*
	Copyright (C) 2009 jungil Han <jungil.Han@gmail.com>

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __MKHTTP_H__
#define __MKHTTP_H__

#include "../mkBase.h"
#include <QHttp>

class QUrl;
class QByteArray;
class QHttpResponseHeader;

class mkHttp : public QHttp {
	Q_OBJECT

public:
	mkHttp( IN QObject *a_pParent = NULL );
	virtual ~mkHttp();

	void SetUrl( IN QString &a_refUrl );
	virtual int Connect();

	QString GetUrl();
	QString GetHost();

protected:
	virtual void OnFinished( IN QByteArray &a_baHttpData ) {}

private slots:
	void ReadResponseHeader( const QHttpResponseHeader &a_refResponseHeader );
	void HttpRequestFinished( int a_nRequestId, bool a_bError );

protected:
	QUrl *m_pUrl;
	QIODevice *m_pHttpData;

	int m_nHttpId;

private:
	bool m_bIsCompleted;

};

#endif /* MKHTTP_H_ */
